home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-10-12 | 3.3 KB | 111 lines | [UVtx/UVtl] |
- // initDebug and printDebug - debug aids
- ////////////////////////
- Function initDebug(oldP)
- oldP = penName()
- Pen name="debug"
- Up
- Goto -width()/2 + 10, height()/2 - 10, -90
- Pen fontsize=10
- Pen name=oldP
- Function printDebug(s,v,oldP)
- oldP = penName()
- Pen name="debug"
- Print s . " = \"" . v . "\""
- Forward 11
- Pen name=oldP
-
- // getName - prompt the user for his/her name
- //////////////////////////////////////////
- Function getName(n)
- Clear 41230,62275,63487
- Color 65000,44953,5910
- Pen fontsize=14
- Up
- Goto -100,0,0
- Down
- Print "Your name, please: ",move
- Forward 100
- Backward 100
- Pen fontname="Times", fontsize=14
- Color 65535,12866,9734
- n = ask(105)
- If (n = "") // error if the name is null
- Sound "Boing"
- up
- go x()-120, y()-120, 0
- pr "Run again, please..."
- Halt
- up
- go x()-120, y()-120, 0
- pr "PLEASE WAIT..."
- Return n
-
- // makePictures - create a pictures for each letter of the name
- /////////////////////////////////////////////////////////
- Function makePictures(theName, i, c, r, g, b)
- Repeat i, 0, length(theName)-1, 1
- c = substr(theName, i, 1)
- r = 30000+random(30000)
- g = 30000+random(30000)
- b = 30000+random(30000)
- Picture c
- Color r,g,b
- Pen fontname="Geneva",fontstyle="Bold",fontsize=14
- Print c
-
- // compStartPos - compute the start x,y of each letter
- /////////////////////////////////////////////////
- Function compStartPos(theName, i)
- Repeat i, 0, length(theName)-1, 1
- startX[i] = random(width()-20) - width()/2
- startY[i] = random(height()-20) - height()/2
-
- // compEndPoints - compute the end x of the name's animation
- //////////////////////////////////////////////////////////
- Function compEndPoints(theName, i)
- Pen fontname="Geneva",fontstyle="Bold",fontsize=14
- Repeat i, 0, length(theName)-1, 1
- endX[i] = sWidth(substr(theName, 0, i))
-
- // compPens - compute the pens for the letters' animation
- /////////////////////////////////////////////////////
- Function compPens(theName, i, dX, c)
- Repeat i, 0, length(theName)-1, 1
- dX = startX[i] - endX[i]
- len[i] = sqrt( dX*dX + startY[i]*startY[i] )
- step[i] = len[i]/20
- c = substr(theName, i, 1)
- Pen name=i, speed=len[i], end="no", picture=c
- Up
- Goto startX[i], startY[i], atan2(startY[i],dX)-180
- Down
-
- // MoveThemAll - move all the letters together
- ///////////////////////////////////////////
- Function MoveThemAll(myName)
- trailMode = "yes"
- Repeat i, 1, 20, 1
- If i > 19
- trailMode="no"
- Pen name=""
- Up
- Goto 0,-sDescent()-1,0
- Down
- Fill 1,65535,65535,65535
- Repeat 2
- Forward sWidth(myName)
- Left 90
- Forward sDescent()+sAscent()+4
- Left 90
- //Sound "Pop"
- Repeat c, 0, length(myName)-1, 1
- Pen name=c, trail=trailMode, end="yes"
- Forward step[c]
-
- // MoveThemOneByOne - move one by one
- /////////////////////////////////////
- Function MoveThemOneByOne(myName)
- Repeat c, 0, length(myName)-1, 1
- Pen name=c, trail="yes", end="yes"
- Forward len[c]
-